package com.dycx.api.controller.manage.user;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dycx.user.dto.WithdrawDepositDTO;
import com.dycx.user.vo.WithdrawDepositVO;
import com.dycx.user.service.WithdrawDepositService;
import com.dycx.common.RestResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;


/**
 * 资金明细(WithdrawDepositApply)表控制层
 *
 * @author wuzongbing
 * @since 2024-08-22 16:16:38
 */
@RestController
@RequestMapping(value = "manage/user/withdrawDeposit")
public class WithdrawDepositController {
    /**
     * 服务对象
     */
    @Resource
    private WithdrawDepositService withdrawDepositService;

    /**
     * 分页
     *
     * @author wzb
     **/
    @PostMapping("getPage")
    public RestResponse<Page<WithdrawDepositVO>> getPage(@RequestBody WithdrawDepositDTO dto) {
        return RestResponse.success(withdrawDepositService.getPage(dto));
    }

    /**
     * 查询详细
     *
     * @author wzb
     **/
    @GetMapping("load")
    public RestResponse<WithdrawDepositVO> load(Integer id) {
        return RestResponse.success(withdrawDepositService.load(id));
    }

    /**
     * 添加
     *
     * @author wzb
     **/
    @PostMapping("create")
    public RestResponse<Boolean> create(@RequestBody @Valid WithdrawDepositDTO dto) {
        return withdrawDepositService.create(dto) ? RestResponse.success() : RestResponse.fail();
    }

    /**
     * 修改
     *
     * @author wzb
     **/
    @PostMapping("edit")
    public RestResponse<Boolean> edit(@RequestBody @Valid WithdrawDepositDTO dto) {
        return withdrawDepositService.edit(dto) ? RestResponse.success() : RestResponse.fail();
    }


    /**
     * 刪除
     *
     * @author wzb
     **/
    @GetMapping("delete")
    public RestResponse<Boolean> delete(Integer id) {
        return withdrawDepositService.delete(id) ? RestResponse.success() : RestResponse.fail();
    }
}

